import React from 'react'
import { render } from 'react-dom'
import { createStore } from 'redux'
import { Provider } from 'react-redux'

import App from './components/App'
import reducer from './reducers'

// reducer
// App
const store = createStore(reducer);

render(
  <Provider store={store}>
    <App />
  </Provider>,
  document.getElementById('root')
);

// var onIncrement= ()=> store.dispatch({type: "INCREMENT"});
// var onDecrement= ()=> store.dispatch({type: "DECREMENT"});
//
// const Counter = ({value}) => (
//     <div>
//     <h1>{value}</h1>
//     <button onClick={onIncrement}>+</button>
//     <button onClick={onDecrement}>-</button></div>
// );
//
// const reducer = (state=0, action) => {
//     switch (action.type) {
//         case "INCREMENT": return state + 1;
//         case "DECREMENT": return state - 1;
//         default: return state;
//     }
// };
//
// const store = createStore(reducer);
//
// const r = () => {
//     render(<Counter value={store.getState()} />, document.getElementById("root"));
// }
//
// r();
//
// store.subscribe(r);



















